package com.ds.lens.data.configuration;

import com.ds.lens.data.common.document.MailConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Description:
 *
 * @author WeiShaoying
 * @date 2020-02-18
 */
@Slf4j
@Configuration
public class EmailConfiguration {
    @Value("${mail.smtp.host}")
    private String mailHost;

    @Value("${mail.smtp.port}")
    private Integer mailPort;

    @Value("${mail.smtp.from}")
    private String mailFrom;

    @Value("${mail.smtp.username}")
    private String mailUsername;

    @Value("${mail.smtp.password}")
    private String mailPassword;

    @Bean
    public MailConfig mailConfig() {
        MailConfig mailConfig = new MailConfig();
        mailConfig.setMail_smtp_from(mailFrom);
        mailConfig.setMail_smtp_host(mailHost);
        mailConfig.setMail_smtp_password(mailPassword);
        mailConfig.setMail_smtp_port(mailPort);
        mailConfig.setMail_smtp_username(mailUsername);
        return mailConfig;
    }

}
